package com.ssm.service;

import com.ssm.dao.ProductMapper;
import com.ssm.pojo.ProductPojo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProductServiceImpl implements ProductService{
    //@Autowired
    private ProductMapper productMapper;

    //spring使用set注入到IOC容器中
    public void setProductMapper(ProductMapper productMapper) {
        this.productMapper = productMapper;
    }

    public int addProduct(ProductPojo productPojo) {
        return productMapper.addProduct(productPojo);
    }

    public int deleteProduct(String pid) {
        return productMapper.deleteProduct(pid);
    }

    public int updateProduct(ProductPojo productPojo) {
        return productMapper.updateProduct(productPojo);
    }

    public ProductPojo selectProductById(String pid) {
        return productMapper.selectProductById(pid);
    }

    public List<ProductPojo> selectAllProduct() {
        return productMapper.selectAllProduct();
    }

    public int selectAllProductCount() {
        return productMapper.selectAllProductCount();
    }

    public List<ProductPojo> selectAllProductLimit(int beginRow, int rows) {
        return productMapper.selectAllProductLimit(beginRow,rows);
    }

    //筛选，去重查询
    public List<String> selectDistinctPid() {
        return productMapper.selectDistinctPid();
    }

    public List<String> selectDistinctPname() {
        return productMapper.selectDistinctPname();
    }

    public List<String> selectDistinctMarketPrice() {
        return productMapper.selectDistinctMarketPrice();
    }

    public List<String> selectDistinctPrice() {
        return productMapper.selectDistinctPrice();
    }

    public List<String> selectDistinctPdate() {
        return productMapper.selectDistinctPdate();
    }

    public List<String> selectDistinctIsHot() {
        return productMapper.selectDistinctIsHot();
    }

    public List<String> selectDistinctFlag() {
        return productMapper.selectDistinctFlag();
    }

    public List<String> selectDistinctCid() {
        return productMapper.selectDistinctCid();
    }

    public List<ProductPojo> selectForm(HashMap<String,String> strMap) {
        return productMapper.selectForm(strMap);
    }

    public List<ProductPojo> selectForm2(Map<String, String> map) {
        return productMapper.selectForm2(map);
    }

}
